module.exports = (userMsg)=>{
    return function(req, res, next){
        let i = 0;
        const flag = userMsg.some((val,idx)=>{
            i = idx;
            return val.username === req.query.username
        })
        if(flag){
            if(userMsg[i].password === req.query.password){
                // 登录成功
                res.send({
                    code:1,
                    title:"成功",
                    data:userMsg[i].username
                })
            }else{
                // 密码不对，登录失败
                res.send({
                    code:0,
                    title:"密码不对",
                    data:""
                })
            }
        }else{
            // 用户名不存在，登录失败
            res.send({
                code:2,
                title:"用户名不存在",
                data:""
            })
        }
    }
}